import {Affix, Button} from 'antd';
import React, {Component} from 'react';

/**
 * https://blog.csdn.net/weixin_30416871/article/details/94885711
 * 子组件调用父组件方法
 */


/*https://ant.design/components/affix-cn/#API*/
/*export const SubmitBlog = () => {

    const [top, setTop] = useState(700);
    function addBlog() {
        alert("addBlog")

        this.props.parentAddArticle();
    }
    return (
        <>
            <Affix offsetTop={top}>
                <Button type="primary" onClick={() => {
                    setTop(top)
                }} style={{float: "right"}} onClick={addBlog}>
                    发 - - 布
                </Button>
            </Affix>

        </>
    );


};*/


class SubmitBlog extends Component {
    constructor(props) {
        super(props)
        this.state={};
    }
     addBlog() {
        this.props.parentAddArticle();
        //https://blog.csdn.net/weixin_33919950/article/details/91943935
    }
    render() {
        const top=700;

        return (

                <>
                    <Affix offsetTop={top}>
                        <Button type="primary" onClick={()=>{this.addBlog()}} style={{float: "right"}} >
                            发 - - 布
                        </Button>
                    </Affix>

                </>

        );
    }
}

export default SubmitBlog;

/*
import { Affix, Button } from 'antd';
import React, { useState } from 'react';

const App = () => {
    const [top, setTop] = useState(10);
    const [bottom, setBottom] = useState(10);
    return (
        <>
            <Affix offsetTop={top}>
                <Button type="primary" onClick={() => setTop(top + 10)}>
                    Affix top
                </Button>
            </Affix>
            <br />
            <Affix offsetBottom={bottom}>
                <Button type="primary" onClick={() => setBottom(bottom + 10)}>
                    Affix bottom
                </Button>
            </Affix>
        </>
    );
};

export default App;*/
